#!/bin/bash


managerNodeName=$1
businessNodeName=$2
mainclass=indi.zjh.dp.startup.Main
startbin=java
libscmd=""

libs=`ls ./lib`
for lib in $libs;
do
        libscmd=$libscmd"./lib/"$lib":"
done

libscmd=$libscmd"./conf:./vc:./busi.jar:./src:./lib/dp.jar:."

rm -rf ./busi.jar ./lib/dp.jar ./conf/router.xml ./conf/busi.xml
cp -f /tmp/busi.jar .
rm -rf /tmp/busi && mkdir /tmp/busi && cp -f /tmp/busi.jar /tmp/busi && cd /tmp/busi && jar xvf busi.jar && cd -
dirs=`ls -l /tmp/busi/ |grep ^d|grep -v META-INF|awk '{print $9}'`
for d in $dirs; do
        echo $d
        cp -Rf /tmp/busi/$d ./src/
done
cp -f /tmp/dp.jar ./lib/
cp -f /tmp/router.xml ./conf/
cp -f /tmp/busi.xml ./conf/
rm -rf ./vc/*

$startbin -DManager.NodeName=$managerNodeName -DBusiness.NodeName=$businessNodeName -cp $libscmd $mainclass
